//
//  ReadingMeterTaskModel.swift
//  Employee
//
//  Created by tancheng on 2018/6/23.
//  Copyright © 2018年 remotevillage. All rights reserved.
//

import Foundation
import SwiftyJSON


enum ReadingMeterTaskStatusType: String {
    case waitCommit = "waitCommit" //
    case expired = "expired"   //
    case submission = "submission" //
}

struct ReadingMeterTaskModel: ModelProtocol {
    
    var cooperation = false
    var meterId = ""
    var status: ReadingMeterTaskStatusType = .waitCommit
    var taskId = ""
    var title = ""
    var meterReadDate = ""
    
    var detail: ReadingMeterTaskDetailModel
    
    
    
    init(json: JSON) {
        cooperation = json["cooperation"].boolValue
        meterId = json["meterId"].stringValue
        
        status = ReadingMeterTaskStatusType.init(rawValue: json["status"].stringValue) ?? .waitCommit
        
        taskId = json["taskId"].stringValue
        title = json["title"].stringValue
        meterReadDate = json["meterReadDate"].stringValue
        
        detail = ReadingMeterTaskDetailModel.init(json: json["detail"])
        
    }
    
    static func array(from jsonArray: [JSON]) -> [ReadingMeterTaskModel] {
        return jsonArray.map({ ReadingMeterTaskModel.init(json: $0)})
    }
}

struct ReadingMeterTaskSend {
    var keyword: String?
    var pageIndex = "1"
    var pageSize = "20"
    var meterReadDate = ""
    var type = false
    
}
